package com.yf.exam.modules.trainingarchives.evaluation.controller;


import com.yf.exam.common.entity.Result;
import com.yf.exam.core.api.dto.BaseIdReqDTO;
import com.yf.exam.core.exception.ServiceException;
import com.yf.exam.modules.trainingarchives.evaluation.dto.CreateEvaluationDTO;
import com.yf.exam.modules.trainingarchives.evaluation.dto.EvaluationExplainDTO;
import com.yf.exam.modules.trainingarchives.evaluation.service.IEvaluationService;
import com.yf.exam.modules.trainingarchives.evaluation.vo.EvaluationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * <p>
 * 满意度调查表 前端控制器
 * </p>
 *
 * @author lql
 * @since 2025-01-06
 */
@Api(tags={"满意度调查表"})
@RestController
@RequestMapping("/org/api/evaluation")
public class EvaluationController {

    @Resource
    private IEvaluationService iEvaluationService;

    /**
     * 添加或修改
     * @param reqDTO
     * @return
     */
    @ApiOperation(value = "生成培训板满意度调查问卷")
    @PostMapping(value = "/createEvaluation")
    public Result<String> createEvaluation(@RequestBody CreateEvaluationDTO reqDTO) {
        try {
            //复制参数
            return Result.ok(iEvaluationService.createEvaluation(reqDTO));
        }catch (ServiceException e){
            return Result.faild(e);
        }
    }

    @ApiOperation(value = "获取满意度调查问卷")
    @PostMapping(value = "/getEvaluation")
    public Result<EvaluationVO> getEvaluation(@RequestBody BaseIdReqDTO reqDTO) {
        try {
            EvaluationVO evaluationVO = iEvaluationService.getEvaluation(reqDTO.getId());
            return Result.ok(evaluationVO);
        }catch (ServiceException e){
            return Result.faild(e);
        }



    }
}
